package main

import "fmt"

func main() {
	//内建函数copy
	data := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
	s1 := data[8:]
	s2 := data[:5]

	copy(s1, s2)
	fmt.Println(s1, data)

	//切片作为函数参数
	test(data)

	fmt.Println("main:")
	for i, v := range data {
		fmt.Printf("slice[%d]=%d\n", i, v)
	}
}

func test(s []int) {
	s[0] = 1
	fmt.Println("test:")
	for i, v := range s {
		fmt.Printf("s[%d]=%d\n", i, v)
	}
}
